package com.technicalkeeda.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.technicalkeeda.bean.Login;
import com.technicalkeeda.services.LoginService;

public class LoginController extends SimpleFormController {

	private LoginService loginService;

	public LoginController() {
		setCommandClass(Login.class);
		setCommandName("login");

	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	@Override
	protected ModelAndView onSubmit(Object command) throws Exception {
		Login login = (Login) command;
		loginService.add(login);
		return new ModelAndView("loginsucess", "login", login);

	}

}
